import {Form, Input, Modal} from 'antd';
import {useEffect, useState} from "react";
import {classificationEditing} from "@/services/ant-design-pro/marketing";

const Index = (props) => {
  const {isModalAdd,titleName,cationEdit,cationCancel,initialId} = props
  //  经 Form.useForm() 创建的 form 控制实例
  const [form] = Form.useForm();
  //
  const [cation,setCation] = useState({})
  useEffect(async ()=>{
    const cations = await classificationEditing(initialId)
    setCation(cations)
    console.log(cations)
  },[])
  // @ts-ignore
  return (
    <div>
      <Modal
        destroyOnClose={true}
        title={titleName}
        visible={isModalAdd}
        onOk={() => {
          form.validateFields().then(values => {
            cationEdit(values)
          })
        }}
        onCancel={cationCancel}
      >
        <Form form={form} initialValues={cation}>
          <Form.Item name='nickname'>
            <Input type="text"/>
          </Form.Item>
        </Form>
      </Modal>
    </div>
  );
};

export default Index;
